package com.globaldom.utils;

import javax.persistence.EntityManager;

import com.globaldom.model.Science;

public class ScienceUtil {

	public void populateScience() {

		for (int i = 1; i <= 30; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(1000 * i);
			s.setResearchType(1);
			s.setResearchValue(5+i);
			s.setResearchSubject("House");
			s.setResearchText("Adds " + (5+i)+" more civilians");
			s.setResearchImage("science/house.png");
			emf.persist(s);
			emf.close();
		}

		String [] mildef={"Body Armour","Personnel Armour","Bio Detector","Robots",
				"Camouflage","Ballistic Vests","Combat Helmets",
				"Military Fortification","Armoured Fighting Vehicles","Heavy Military Fortification"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(1000 * i);
			s.setResearchType(100);
			s.setResearchSubject(mildef[i-1]);
			s.setResearchText("Increases defence of the Army");
			s.setResearchImage("science/armydefence.png");
			emf.persist(s);
			emf.close();
		}

	String[]	tankdef={"Composite Armour","Rolled homogeneous armour","Ceramic plate",
			"Chobham armour","Applique armour","Improvised vehicle armour","Sloped armour",
			"Reactive armour","Active protection systems","Electrically charged armour"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(2000 * i);
			s.setResearchType(101);
			s.setResearchSubject(tankdef[i-1]);
			s.setResearchText("Increases defence of the Tanks");
			s.setResearchImage("science/tankdefence.png");
			emf.persist(s);
			emf.close();
		}

		String[]	airdef={"Radio technology","Radar","GPS Technology","Aegis radar",
				"MPS Technology","PPS Technology","Stealth Aircraft","Surveillance aircraft",
				"Aerial tanker","Interceptors"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(3000 * i);
			s.setResearchType(102);
			s.setResearchSubject(airdef[i-1]);
			s.setResearchText("Increases defence of the Aircrafts");
			s.setResearchImage("science/airdefence.png");
			emf.persist(s);
			emf.close();
		}

		String[]	navdef={"Hydraulics","Armoured Cruiser","Vertical triple-expansion",
				"Invincibles","Frigates","Minesweeper","Patrol boats",
				"Replenishment ships","Advanced Communication","Nuclear fuel"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(4000 * i);
			s.setResearchType(103);
			s.setResearchSubject(navdef[i-1]);
			s.setResearchText("Increases defence of the Navy");
			s.setResearchImage("science/navydefence.png");
			emf.persist(s);
			emf.close();
		}

		String[]	spydef={"Diplomatic Immunity","Embassy","Telegraph","Bug detector",
				"Satellite Phones","GPS Trackings","Cipher Technology","Counter Intelligence",
				"Central Intelligence","Embassy Development"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(5000 * i);
			s.setResearchType(104);
			s.setResearchSubject(spydef[i-1]);
			s.setResearchText("Increases defence of the Spies");
			s.setResearchImage("science/spydefence.png");
			emf.persist(s);
			emf.close();
		}

		String[]	subdef={"Sonar Technology","Sonar development","Saddle tanks",
				"Dynamic Diving ","Aft Hydroplanes ","Vented ballast tank ","Flexible ballast tank",
				"Pressure ballast tank","Piston ballast tank","Membrane ballast tank"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(6000 * i);
			s.setResearchType(105);
			s.setResearchSubject(subdef[i-1]);
			s.setResearchText("Increases defence of the Submarines");
			s.setResearchImage("science/subdefence.png");
			emf.persist(s);
			emf.close();
		}

		String[]	milatt={"Gun Powder","Night Vision Goggles","Carbine Development",
				"Biological Warfare","Chemical Warfare","Military Fortification","Electronic Warfare",
				"Heavy anti-tank weapon","Nuclear Fission","Nuclear Fusion"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(1000 * i);
			s.setResearchType(200);
			s.setResearchSubject(milatt[i-1]);
			s.setResearchText("+1 Attack point of the Army");
			s.setResearchImage("science/armyattack.png");
			emf.persist(s);
			emf.close();
		}

		String[]	tankatt={"Cluster Bomb","Blister Agent","Revolving turret",
				"Traversable turret","Thermal imagers","Automated fire control","Turbine-electric",
				"Auto-Loader","Laser rangefinder","Thermocouple"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(2000 * i);
			s.setResearchType(201);
		
			s.setResearchSubject(tankatt[i-1]);
			s.setResearchText("+1 Attack point for the Tanks");
			s.setResearchImage("science/tankattack.png");
			emf.persist(s);
			emf.close();
		}

		String[]	airatt={"Hellfire Missile","Hellfire Missile improvement","Remotely Piloted Vehicle",
				"Air to Surface Missile","Unmanned Aerial Vehicle","Attack helicopter","Missile Guidance System",
				"Laser Guided Weapon","Infrared Photography","Improvised Nuclear Device"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(3000 * i);
			s.setResearchType(202);
		
			s.setResearchSubject(airatt[i-1]);
			s.setResearchText("+1 Attack point for the Aircrafts");
			s.setResearchImage("science/airattack.png");
			emf.persist(s);
			emf.close();
		}

		
		String[]	navatt={"Aircraft carrier","Aircraft carrier improvement","Super aircraft carrier",
				"Amphibious assault ships","Cluster Bombs","Destroyers","Ballistic Missiles",
				"Navy Fortification","Cruise Missile","Nuclear Missile"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(4000 * i);
			s.setResearchType(203);
			s.setResearchSubject(navatt[i-1]);
			s.setResearchText("+1 Attack point for the Navy");
			s.setResearchImage("science/navyattack.png");
			emf.persist(s);
			emf.close();
		}

		
		String[]	spyatt={"Pocket Camera","Invisible Ink","Cyber Spies","Shortwave Radio",
				"Burst Transmissions ","Number Stations","Transposition Ciphers","GPS Transmitters",
				"Super Computer","Satellite Communications"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(5000 * i);
			s.setResearchType(204);
			s.setResearchSubject(spyatt[i-1]);
			s.setResearchText("+1 Attack point for the Spies");
			s.setResearchImage("science/spyattack.png");
			emf.persist(s);
			emf.close();
		}

		String[]	subatt={"Torpedoes","Guided Torpedoes","External Torpedoes","Sonar","Active Sonar",
				"Deep Submergence Vehicle","Deck guns",
				"Electric-Ship System","Cruise Missile","Nuclear Missile"};
		for (int i = 1; i <= 10; i++) {
			EntityManager emf = EMF.get().createEntityManager();
			Science s = new Science();
			s.setMinLevel(i);
			s.setResearchAmount(6000 * i);
			s.setResearchType(205);
			s.setResearchSubject(subatt[i-1]);
			s.setResearchText("+1 Attack point for the Submarines");
			s.setResearchImage("science/subattack.png");
			emf.persist(s);
			emf.close();
		}

	}

}
